home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / currency.doc < prev    next >
Text File  |  1995-03-31  |  4KB  |  71 lines

  1.                HP 48 Currency Converter Key Assignment 
  2.                            by Jeremy Smith 
  3.  
  4.        This key assignment allows conversion between the currencies of 52 
  5. countries.  Pressing CST displays the (first six) flags of all 52 
  6. countries in the menu bar.  Pressing a number followed by a flag puts 
  7. the quantity and denomination in level one.  Pressing left-shift 
  8. (orange) and a different flag will convert to the correct quantity and 
  9. denomination of the new country.  For example, pressing 3 and the 
  10. Australian flag (CST B) puts 3_$A on level one.  Pressing left-shift 
  11. (orange) and the Canadian flag (NXT B) converts it to 2.69_Can$ in 
  12. level one. 
  13.        Amounts may be added no matter what currency each amount is, 
  14. with automatic conversion to whatever currency is in level one.  For 
  15. instance, 3_$A in level two added to 3_Can$ in level one yields 
  16. 5.69_Can$ in level one. 
  17.  
  18. Technical Details 
  19.        The money directory contains the variable CST (2945.5 bytes) and 
  20. 52 currency variables (312 bytes).  CST is a list of 52 items, each 
  21. item being a list of the form { GROB 21x8 '1_$A' }.  The GROB is the 
  22. flag graphic and the '1_$A' is the currency.  The corresponding 
  23. variable in this case is '$A', which has a value of 0.785_$.  All the 
  24. currency variables are defined in terms of US$ (1_$). 
  25.        The US dollar is (arbitrarily) defined as 1_mol since this built- 
  26. in basic SI unit is one of quantity and therefore less unrelated to 
  27. currency than any other basic SI unit.  By defining currency as a 
  28. built-in unit conversions are handled automatically by the machine 
  29. (fast, accurately and simply) just like built-in units.  UBASE() on any 
  30. amount reduces it to moles, but the result can be converted back into 
  31. units of currency with the regular currency conversions on CST. 
  32.        A disadvantage is that it is as trivial to generate multiples, 
  33. divisions and powers of currency units (alone and in combinations).  
  34. 10_$^2 is meaningless but ( 10_$ / 2_Can$ ) 5_$/Can$ can be reduced 
  35. using UBASE() to 5.7182, the amount of Can$ in 5 US$. 
  36.        The 52 countries, currencies and currency symbols are listed as 
  37. comments at the end of the directory listing below.  Some currency 
  38. symbols conflict with built-in units and so alternatives were chosen; 
  39. these are listed in the table. 
  40.        There is an additional directory 'Flags' (2472 bytes) which 
  41. contains the 52 flag GROBs named by country.  It also contains a small 
  42. program 'Grab' which grabs the top left 21x8 pixels of the current PICT 
  43. to a GROB in level 1.  I used this to draw and save all the flags for 
  44. the menus.  This whole subdirectory is not necessary for the operation 
  45. of the currency conversion key assignment and can be deleted (to save 
  46. >2472 bytes).  It is handy for editing  nd keeping copies of the flags. 
  47.        Adding new currencies is simply a matter of adding a new two part 
  48. list to the CST list, and also storing a corresponding variable with 
  49. the correct value defined in dollars (or any other valid denomination).  
  50. If you actually use this converter you'll probably want to 
  51. (drastically) reduce the number of conversions available.  Simply 
  52. remove each two part list from the CST list, and the corresponding 
  53. variable. 
  54.        There is no on-line help regarding what country any currency or 
  55. flag belongs to.  Refer to the table.  By tagging the GROBs in the CST 
  56. list with the country name, or just replacing the GROB with a string 
  57. for the country, the country name appears in the menu instead of the 
  58. flag.  For practical use this might be more expedient. 
  59.        I discovered these two methods in trying to tag the GROB for 
  60. documentation purposes, and using a variable to reference the GROB 
  61. since it would be simpler to edit a GROB by itself rather than the 
  62. ungainly CST variable.  Unfortunately, those names showed up in the 
  63. menus instead of the graphic. 
  64.        I was unable to find pictures of flags for Bahrain, Jordan, 
  65. Kuwait, and Taiwan, so I have substituted a `test-pattern'.  Feel 
  66. free to generate these, and improve on any other of the graphics. 
  67.        The countries represented are mostly those that are listed daily 
  68. in the (Foreign) Exchange Rates column in the Wall Street Journal.  Use 
  69. this to keep the exchange rates current.  I think I'll try writing a 
  70. program next.  smithj@jacobs.cs.orst.edu <Jeremy |-) Smith> 9/9/91 
  71.